//显示数据列表
let dataList = []

function showUser() {
    $.ajax({
        type: "GET",
        url: 'http://10.7.171.143:8088/api/list',
        // data: {
        //     pageNo
        // },
        success: function (data) {
            if (data.resultCode == 1) {
                // let list = data.resultInfo.list
                // dataList = [...dataList, ...list]
                //showUserList(data.resultInfo)
                let newData=data.resultInfo
                let htmlStr = template("show", {newData})
                $('table').html(htmlStr)
            }
        }

    })
}

//数据操作
function onUser() {
    $('table').on('click', '.delete', function () {
        let id = $(this).attr('data_index')
        let isDelete = confirm('确定要删除？')
        if (isDelete == false) {
            alert('删除失败！')
            return
        }
        $.ajax({
            type: "GET",
            url: 'http://10.7.171.143:8088/api/delete',
            data: {
                uid: id
            },
            success: function (data) {
                if (data.resultCode == 1) {
                    alert('删除成功！')
                    showUser()
                }
            }

        })
    })
}

showUser()
onUser()
scroll()